//
//  SPDeviceMessage.m
//  Sampux
//
//  Created by rzm on 16/8/19.
//  Copyright © 2016年 rzm. All rights reserved.
//

#import "SPDeviceMessage.h"

@implementation SPDeviceMessage

+ (SPDeviceMessage *)sharedManager
{
    static SPDeviceMessage *deviceMessage = nil;
    static dispatch_once_t predicate;
    dispatch_once(&predicate, ^{
        deviceMessage = [[self alloc] init];
    });
    return deviceMessage;
}

- (NSMutableArray *)deviceMessageArr
{
    if (!_deviceMessageArr) {
        _deviceMessageArr = [NSMutableArray array];
    }
    return _deviceMessageArr;
}

+ (SampuxListModel *)getDeviceMessageWithAccount:(NSString *)account
{
    __block SampuxListModel *model = nil;
    NSMutableArray *arr = [SPDeviceMessage sharedManager].deviceMessageArr;
    if (!arr)
        return nil;
    [arr enumerateObjectsUsingBlock:^(SampuxListModel *obj, NSUInteger idx, BOOL * _Nonnull stop) {
        if ([obj.accountStr isEqualToString:account]) {
            model = obj;
        }
    }];
    return model;
}
@end
